<template>
	<div class="home" style="margin-top: 60px;">
		<el-row :gutter="20">
			<el-col :span="6">
				<el-card shadow="hover" class="home-head">
					<div class="grid-content bg-purple">
						<i class="el-icon-user-solid" style="background-color: #007bff;"></i>
						<div class="home-icon">
							<h4>30</h4>
							<small class="text-user">关注人数(个)</small>
						</div>
					</div>
				</el-card>
			</el-col>
			<el-col :span="6">
				<el-card shadow="hover" class="home-head">
					<div class="grid-content bg-purple">
						<i class="el-icon-s-finance" style="background-color: #28a745;"></i>
						<div class="home-icon">
							<h4>120</h4>
							<small class="text-user">订单总数(笔)</small>
						</div>
					</div>
				</el-card>
			</el-col>
			<el-col :span="6">
				<el-card shadow="hover" class="home-head">
					<div class="grid-content bg-purple">
						<i class="el-icon-s-order" style="background-color: #dc3545;"></i>
						<div class="home-icon">
							<h4>4183.80</h4>
							<small class="text-user">今日订单总金额(元)</small>
						</div>
					</div>
				</el-card>
			</el-col>
			<el-col :span="6">
				<el-card shadow="hover" class="home-head">
					<div class="grid-content bg-purple">
						<i class="el-icon-s-data" style="background-color: #ffc107;"></i>
						<div class="home-icon">
							<h4>100</h4>
							<small class="text-user">本月销量(笔)</small>
						</div>
					</div>
				</el-card>
			</el-col>
		</el-row>


		<el-row :gutter="20" class="home-item">
			<el-col :span="12">
				<el-card shadow="hover" class="row-card">
					<div class="grid-content bg-purple">
						<div class="home">
							<span>店铺及商品提示</span>
							<el-button type="text" style="color: teal; text-align: right;">需要关注的店铺信息及待处理事项</el-button>
						</div>
					</div>
				</el-card>
			</el-col>
			<el-col :span="12">
				<el-card shadow="hover" class="row-card">
					<div class="grid-content bg-purple">
						<div id="main" style="width: 100%;height:400px;"></div>
					</div>
				</el-card>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	export default {
		// 组件名称
		name: 'demo',
		// 组件参数 接收来自父组件的数据
		props: [],
		// 局部注册的组件
		components: {},
		// 组件状态值
		data() {
			return {

			}
		},
		mounted() {
			var myChart = this.$echarts.init(document.getElementById('main'));
			var option = {
				tooltip: {
					trigger: 'axis',
					axisPointer: {
						type: 'cross',
						label: {
							backgroundColor: '#6a7985'
						}
					}
				},
				legend: {
					data: ['邮件营销', '联盟广告', '视频广告', '直接访问', '搜索引擎']
				},
				toolbox: {
					feature: {
						saveAsImage: {}
					}
				},
				grid: {
					left: '3%',
					right: '4%',
					bottom: '3%',
					containLabel: true
				},
				xAxis: [{
					type: 'category',
					boundaryGap: false,
					data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
				}],
				yAxis: [{
					type: 'value'
				}],
				series: [{
						name: '邮件营销',
						type: 'line',
						stack: '总量',
						areaStyle: {},
						data: [120, 132, 101, 134, 90, 230, 210]
					},
					{
						name: '联盟广告',
						type: 'line',
						stack: '总量',
						areaStyle: {},
						data: [220, 182, 191, 234, 290, 330, 310]
					},
					{
						name: '视频广告',
						type: 'line',
						stack: '总量',
						areaStyle: {},
						data: [150, 232, 201, 154, 190, 330, 410]
					},
					{
						name: '直接访问',
						type: 'line',
						stack: '总量',
						areaStyle: {},
						data: [320, 332, 301, 334, 390, 330, 320]
					},
					{
						name: '搜索引擎',
						type: 'line',
						stack: '总量',
						label: {
							normal: {
								show: true,
								position: 'top'
							}
						},
						areaStyle: {},
						data: [820, 932, 901, 934, 1290, 1330, 1320]
					}
				]
			};
			// 使用刚指定的配置项和数据显示图表。
			myChart.setOption(option);
		},
		// 计算属性
		computed: {},
		// 侦听器
		watch: {},
		// 组件方法
		methods: {},
		/**
		 * 组件实例创建完成
		 */
		created() {},
	}
</script>

<style lang="scss" scoped>
	.el-row {
		margin-bottom: 20px;
		margin-top: 20px;

		&:last-child {
			margin-bottom: 0;
		}
	}

	.el-col {
		border-radius: 4px;
	}

	.bg-purple-dark {
		background: #99a9bf;
	}

	.bg-purple-light {
		background: #e5e9f2;
	}

	.grid-content {
		border-radius: 4px;
		min-height: 36px;
		display: flex !important;
		align-items: center;

		i {
			width: 40px;
			height: 40px;
			text-align: center;
			line-height: 40px;
			font-size: 25px;
			color: #fff;
			margin-right: 1rem !important;
		}

		.home-icon {
			h4 {
				margin: 0px;
				font-size: 25px;
				margin-bottom: 4px;
			}

			.text-user {
				color: #6c757d;
			}
		}
	}

	.row-bg {
		padding: 10px 0;
		background-color: #f9fafc;
	}
</style>
